Virtual Memory
Small Group Exercise

Assume you have a tiny computer with virtual memory of size 8000 bytes and a physical memory of size 4000 bytes.
The page size is 1000 bytes, so 4 of 8 pages can be in memory at the same time.
(Base 10 is used for convenience.) Thus, the leading digit determines the virtual address page, and the remaining digits determine the offset in the physical memory page.
PAGE TABLE:
Page	Frame
0	3
1	–
2	–
3	1
4	–
5	0
6	–
7	–
(-- means not loaded into physical memory)
Translate the following virtual memory addresses into physical addresses, using above page table:
1001
3333
6102

Assume a reference is made to virtual address 7777, which cause a page fault.
After the page is loaded, what is the corresponding physical address?

The following page request were recorded over time:
1 0 2
2 1 7
6 7 0
1 2 0
3 0 4
5 1 5
2 4 5
6 7 6
7 2 4
2 7 3
2 3 7
Every third access was a write, and a write takes a full memory unit to complete.)

Assuming a LRU policy, show how the contents of memory change over the sequence of page references. You may use a spread sheet if you wish.
Assuming the frames were all initially empty, compute the hit rate.
Virtual Memory
Individual Assignment

Given the same computer setup as before, assuming a FIFO policy, show how the contents of memory change over the sequence of page references. You may use a spread sheet if you wish.
Assuming the frames were all initially empty, compute the hit rate.

Compare your results to the group results.  Which was better in this case?